# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=flatpak-builder
pkgver=1.4.3
pkgrel=0
pkgdesc="Tool to build flatpaks from source"
options="!check" # Testsuite fails on tests that require FUSE
url="https://flatpak.org"
arch="all"
license="LGPL-2.1-or-later"
depends="flatpak git elfutils patch"
makedepends="flatpak-dev glib-dev libsoup-dev json-glib-dev
	elfutils-dev libcap-dev curl-dev appstream-dev
	yaml-dev libxslt docbook-xsl docbook-xml xmlto"
subpackages="$pkgname-doc"
source="https://github.com/flatpak/flatpak-builder/releases/download/$pkgver/flatpak-builder-$pkgver.tar.xz
	modules-load.conf
	musl-fixes.patch
	musl-fixes-error.patch
	hard-disable-rofiles-fuse.patch"
install="$pkgname.post-install"

# secfixes:
#   1.2.2-r0:
#     - CVE-2022-21682

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--sbindir=/usr/bin \
		--libexecdir=/usr/lib/$pkgname \
		--disable-static
	make
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/lib/modules-load.d
	install -m644 "$srcdir"/modules-load.conf "$pkgdir"/usr/lib/modules-load.d/flatpak-builder.conf
}

sha512sums="
45d0e57fb2095005e350498025d1bab697f78858858e3a6d7ef04d259de658735fb981b7fd973b676491dc6915083714085455b1a458b963c7ee7d755604c1d4  flatpak-builder-1.4.3.tar.xz
57d23d2778556eafc3035e6be575bf95b4032f123b35f2b1657eff5e7496de253173edc657f90531ee58e25673f4f27a5cd1cc76b14a038edb244f104a231771  modules-load.conf
57b5e250b46fdb42d9a13f9075a4758c1ddd675ea82435eea078551da43240d637195775c393953a8a0729cbc1f2421456d73eb09906bff36344a4bf0113e71b  musl-fixes.patch
ba7093a41a2717e5cf9043fbc22c7acb2a56264aa691e4462e24a0025a04e12ec4a0a1952c98e03f87de155aa2748877d8635eb5f3b0d7f927f397ce9b84f692  musl-fixes-error.patch
6b61c8ae3afbe0eb14cb14fb885b4e32ca48f9ca2471fef49a20922fe7580db9b3c7e9aca9511f4a281b6a09d01837a78a42be9da036831d27cd98ad1b0b8731  hard-disable-rofiles-fuse.patch
"
